{* $Id$ *}
{include_core file="admin/lib/header.html" title="终端设备"}
  <div class="page-header border-bottom clearfix">
    <h2 class="left">设备管理</h2>
    <a href="{AnUrl('device/admin/create')}" class="btn btn-success btn-sm right"><i class="icon-add"></i>批量创建</a>
  </div>
  <div class="search-level1 clearfix">
    <form action="device/admin" method="get">
      <input type="text" class="left" name="search_filter[device_no]" value="{$search_filter.device_no}" placeholder="序列号">
      <button type="submit" class="btn btn-success btn-sm left">搜索</button>
    </form>
  </div>
  <!--start:列表-->
<div class="list-table-filters">
    <p>
        {$device_res_list = device_config::$TYPES}
        <span class="label label-info">按类型</span>
        <a href='{AnUrl("device/admin?{URLTracker::set("type", "ALL")}")}' {if URLTracker::val("type") == "ALL"} class="label label-primary" {else} class="label label-default" {/if}>全部</a>
        {foreach $device_res_list as $k => $v}
        <a href='{AnUrl("device/admin?{URLTracker::set("type", $k)}")}' {if URLTracker::val("type") == $k} class="label label-primary" {else} class="label label-default" {/if}>{$v.name}</a>
        {/foreach}
    </p>
    <p>
        <span class="label label-info">按状态</span>
        <a href='{AnUrl("device/admin?{URLTracker::set("status", -1)}")}' {if $status == -1} class="label label-primary" {else} class="label label-default" {/if}>全部</a>
        {foreach device_config::$STATUS as $k => $v}
        <a href='{AnUrl("device/admin?{URLTracker::set("status", $k)}")}' {if $status == $k} class="label label-primary" {else} class="label label-default" {/if}>{$v}</a>
        {/foreach}
    </p>
</div>
{include_core file="admin/lib/pager.html"}
  <table class="list-table">
    <thead>
      <tr>
        <th style="width:60px;">序列号</th>
        <th style="width:60px;">状态</th>
        <th>最新绑定信息</th>
        <th>合伙人</th>
        <th style="width:60px;">操作</th>
      </tr>
    </thead>
    <tbody>
      {foreach $device_list as $k=>$v}
        <tr id="dataList{$v.id}" {if $k%2 == 1} class="bg-gray"{/if} data-id="{$v.id}">
          <td>{$v.device_no}</td>
          <td>
          	<a class="btn btn-info btn-xs js_storeDeviceRecord">{machine_config::$status_list[$v.status]}</a>
            {if $v['type'] == 'OS'}
	            {if $v['cash_time']}
	            <span class="label label-warning">已审核</span>
	            {else}
	            <span class="label label-primary">未审核</span>
	            {/if}
            {/if}
          </td>
          <td>
            {if $v['store_info']}
          <h3 style="font-size:1.2em;">{$v.store_info.title}({$v.store_info.title_branch})</h3>
          <p style="color: #666">{$v.store_info.province}, {$v.store_info.city}, {$v.store_info.county}</p>
          <p style="color: #666">{$v.store_info.address}</p>
            {/if}
          </td>
          <td>{$v['agency_id']} {$v['agency_name']}</td>
          <td><a href="{AnUrl("device/admin/get_device_no_record?id={$v.id}&device_no={$v.device_no}")}" class="btn btn-info btn-xs js_storeDeviceRecord">设备历史</a>
          {if $v['type'] == 'OS' && $v['status'] == 2 && $v['agency_id']}
          <a href="{AnUrl("device/admin/return_money_binding?id={$v.id}&agency_id={$v['agency_id']}")}" class="btn btn-primary btn-xs changeStatus-fresh"><i class="icon-edit icon-white"></i>审核返押金</a>
          {/if}
          </td>

        </tr>
      {foreachelse}
          <tr><td class="txtleft" colspan="6">暂无数据</td></tr>
      {/foreach}
    </tbody>
  </table>
{include_core file="admin/lib/pager.html"}
<!--end:列表-->
{load_js file='zclip/jquery.zclip.min.js'}
{load_js file='zclip/ZeroClipboard.js'}
{include_core file="admin/lib/footer.html"}